package 临时工具.粮仓.粉尘检测;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Data
public class test implements Serializable {
    @AllArgsConstructor
    private class Item {
        private String key;
        private String value;
    }
    List<Item> list=new ArrayList<Item>(){{
        add(new Item("01","二氧化碳浓度"));
        add(new Item("02","PM2.5"));
        add(new Item("03","大气温度"));
        add(new Item("04","大气相对湿度"));
        add(new Item("05","TVOC"));
        add(new Item("06","甲醛浓度"));
        add(new Item("07","噪音"));
        add(new Item("08","大气压"));
        add(new Item("09","CO"));
        add(new Item("0A","PM10"));
        add(new Item("0B","Smoke"));
        add(new Item("0C","CH4"));
        add(new Item("0D","SO2"));
        add(new Item("0E","NO2"));
        add(new Item("0F","O3"));
        add(new Item("10","油烟浓度"));
        add(new Item("11","颗粒物浓度"));
        add(new Item("12","风速"));
        add(new Item("13","风向"));
        add(new Item("14","氨气"));
        add(new Item("15","硫化氢"));
        add(new Item("16","氧气"));
        add(new Item("17","负氧离子"));
        add(new Item("18","TSP（粉尘）"));
        add(new Item("19","光照度"));
        add(new Item("1A","太阳辐射量"));
    }
    };

    public static void main(String[] args) {
        test test = new test();
        String collect = test.list.stream().map(e -> {
            return "{\n" +
                    "            \"id\": \"" + e.key + "\",\n" +
                    "            \"name\": \"" + e.value + "\",\n" +
                    "            \"expands\": {\n" +
                    "                \"source\": \"device\",\n" +
                    "                \"storageType\": \"direct\",\n" +
                    "                \"type\": [\n" +
                    "                    \"report\"\n" +
                    "                ]\n" +
                    "            },\n" +
                    "            \"valueType\": {\n" +
                    "                \"type\": \"string\"\n" +
                    "            }\n" +
                    "        }";
        }).collect(Collectors.joining(","));
        System.out.println(collect);
    }
}
